package com.googlecode.ozonbooksfinder.matefinder.actions
{
	import com.asfusion.mate.actionLists.IScope;
	import com.asfusion.mate.actions.AbstractAction;
	import com.asfusion.mate.actions.IAction;
	
	import flash.net.SharedObject;
	
	import mx.collections.ArrayCollection;

	public class LoadFavoritesAction extends AbstractAction implements IAction
	{
		private var favoritesSO:SharedObject = SharedObject.getLocal("favorites");
		
		public function LoadFavoritesAction()
		{
			super();
		}
		
		override protected function run(scope:IScope):void
		{
			super.run(scope);
			
			var favorites:ArrayCollection = new ArrayCollection ();
			
			if (favoritesSO.data.favorites != null)
			{
				favorites.source = favoritesSO.data.favorites as Array;
			}
			
			scope.lastReturn = favorites;
		}
	}
}